<!doctype html>
<html xmlns:th="http://www.thymeleaf.org" >
	<head>
		<meta charset="utf-8">
		<title>系统管理-讲师列表</title>
		<link href="../c/base.css" rel="stylesheet" type="text/css">
		<link href="../c/toefl.css" rel="stylesheet" type="text/css">
		<link href="../c/bootstrap.min.css" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="../j/jquery-2.1.0.js"></script>
		<script type="text/javascript" src="../j/bootstrap.min.js"></script>
		<script type="text/javascript" src="../j/lrtk.js"></script>
		
		
		<link href="../j/ligerUI/skins/Aqua/css/ligerui-dialog.css" rel="stylesheet" type="text/css" />  
		<script src="../j/ligerUI/js/core/base.js" type="text/javascript"></script>
		<script src="../j/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
		<script src="../j/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
		<script src="../j/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
		<script type="text/javascript" th:inline="none">
		 $(function(){
		    	var boxs = $("input[type='checkbox'][id^='box_']");
		    	
		    	$("#checkAll").click(function() {
					boxs.prop("checked", this.checked);
				})
		    	
		 	   $("#delete").click(function(){
		 		   /** 获取到用户选中的复选框  */
		 		   var checkedBoxs = boxs.filter(":checked");
		 		   if(checkedBoxs.length < 1){
		 			   $.ligerDialog.error("请选择一个需要删除的用户！");
		 			  
		 		   }else{
		 			   var ids = checkedBoxs.map(function(){
		 				   return this.value;
		 			   })
		 			   
		 			   $.ligerDialog.confirm("确认要删除吗?","删除用户",function(r){
		 				   if(r){
		 					  window.location = "delUsers?ids=" + ids.get();
		 				   }
		 			   });
		 		   }
		 	   })
		 	   
		 	   $("#freeze").click(function(){
		 		   /** 获取到用户选中的复选框  */
		 		   var checkedBoxs = boxs.filter(":checked");
		 		   if(checkedBoxs.length < 1){
		 			   $.ligerDialog.error("请选择一个需要冷冻的用户！");
		 		   }else{
		 			   var ids = checkedBoxs.map(function(){
		 				   return this.value;
		 			   })
		 			   
		 			   $.ligerDialog.confirm("确认要冷冻吗?","冷冻用户",function(r){
		 				   if(r){
		 					  window.location = "freezeUsers?ids=" + ids.get();
		 				   }
		 			   });
		 		   }
		 	   })
		 	   
		 	   $("#unfreeze").click(function(){
		 		   /** 获取到用户选中的复选框  */
		 		   var checkedBoxs = boxs.filter(":checked");
		 		   if(checkedBoxs.length < 1){
		 			   $.ligerDialog.error("请选择一个需要解冻的用户！");
		 		   }else{
		 			   var ids = checkedBoxs.map(function(){
		 				   return this.value;
		 			   })
		 			   
		 			   $.ligerDialog.confirm("确认要解冻吗?","解冻用户",function(r){
		 				   if(r){
		 					  window.location = "unfreezeUsers?ids=" + ids.get();
		 				   }
		 			   });
		 		   }
		 	   })
		    })    
		
		
		    function schUser(pageNum){
			 $("#pageNum").val(pageNum);
			 $("#schUserForm").submit();
		 	}
		    
		</script>
	</head>

	<body>

		<div class="doc1180 paddingT20 fn-clear container">
			<div>
				<form action="/getUsers" id="schUserForm" class="form-inline" >
					<div class="form-group">
						<label for="exampleInputName2">用户名</label>
						<input name="login_name" th:value="${schUser.login_name}" type="text" class="form-control" id="exampleInputName2" placeholder="Jane Doe">
					</div>
					<div class="form-group">
						<label for="exampleInputEmail2">状态</label>
						<select name="status" class="form-control">
							<option value="">全部</option>
							<option value="2" th:selected="${schUser.status == '2'}">正常</option>
							<option value="0" th:selected="${schUser.status == '0'}">冷冻</option>
						</select>
					</div>
					<div class="form-group">
						<label for="exampleInputEmail2">等级</label>
						<select name="user_level" class="form-control">
							<option value="">全部</option>
							<option value="1" th:selected="${schUser.user_level < 1000 and schUser.user_level > 0}">学渣</option>
							<option value="1000" th:selected="${schUser.user_level >= 1000 and schUser.user_level < 2000}">学霸</option>
							<option value="2000" th:selected="${schUser.user_level >= 2000}">学神</option>
						</select>
					</div>
					<input type="hidden" name="pageNum" id="pageNum" value="${schUser.pageNum}">
					<button type="button" onclick="schUser(1)" class="btn btn-primary">搜索</button>
				</form>

			</div>
			<div class="myPost_Theme" style="height: 80vh;margin-top: 50px;">
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="myPost_Table">
					<tr class="myPost_Th">
						<th><input type="checkbox" name="checkAll" id="checkAll" /></th>
						<th>头像</th>
						<th>用户名称</th>
						<th>性别</th>
						<th>邮箱</th>
						<th>电话</th>
						<th>出生日期</th>
						<th>注册时间</th>
						<th>等级</th>
						<th>状态</th>
					</tr>
					<tr th:each="u,uStatus:${pageInfo.list}">
						<td><input type="checkbox" th:id="'box_'+${uStatus.index}" th:value="${u.user_id}" /></td>
						<td class="myPost_ThemeTitle"><img th:src="${u.img_url}" width="30" height="30"></td>
						<td>
							<a style="color: red;" href="../个人资料/普通用户-首页.html" th:text="${u.login_name}">张三</a>
						</td>
						
						<td th:if="${u.sex == '0'}">男</td>
						<td th:if="${u.sex == '1'}">女</td>
						
						<td th:text="${u.email}">sssss@126.com</td>
						<td th:text="${u.phone_num}">11111111111</td>
						<td th:text="${#dates.format(u.birthday,'yyyy-MM-dd')}">2001-01-01</td>
						<td th:text="${#dates.format(u.register_time,'yyyy-MM-dd')}">2019-01-01</td>
						
						<td th:if="${u.user_level < 1000}">学渣</td>
						<td th:if="${u.user_level >= 1000 and u.user_level < 2000}">学霸</td>
						<td th:if="${u.user_level >= 2000}">学神</td>
						
						<td th:if="${u.status == '0'}">冷冻</td>
						<td th:if="${u.status == '1'}">未完善个人资料</td>
						<td th:if="${u.status == '2'}">正常</td>
					</tr>

				</table>

				<div class="pageList" style="width: 500px;float: right;">
					<ul>
						<li th:each="n:${pageInfo.navigatepageNums}">
							<a href="###" th:onclick="schUser([[${n}]]);">[[${n}]]</a>
						</li>
						
						<li th:unless="${pageInfo.isFirstPage}">
							<a href="###" th:onclick="schUser(1);">首页</a>
						</li>
						<li th:if="${pageInfo.hasPreviousPage}">
							<a href="###" th:onclick="schUser([[${pageInfo.prePage}]]);" class="pret">上一页</a>
						</li>
						<li th:if="${pageInfo.hasNextPage}">
							<a href="###" th:onclick="schUser([[${pageInfo.nextPage}]]);" class="next">下一页</a>
						</li>
						<li th:unless="${pageInfo.isLastPage}">
							<a href="###" th:onclick="schUser([[${pageInfo.pages}]]);">尾页</a>
						</li>
					</ul>
				</div>

				<div id="" class="" style="margin-top: 40px;width: 400px; float: left;">
					<input id="freeze" type="button" class="btn btn-warning" value="冷冻"/>
					<input id="unfreeze" type="button" class="btn btn-primary" value="解冻"/>
					<input id="delete" type="button" class="btn btn-danger" value="删除"/>
				</div>
			</div>

		</div>

	</body>

</html>